1. Field of the Invention
This invention is related to processors and virtualization, and more particularly to delivering interrupts to virtual machine guests.
2. Description of the Related Art
Virtualization has been used in computer systems for a variety of different purposes. For example, virtualization can be used to execute privileged software in a “container” to prevent the privileged software from directly accessing and/or making changes to at least some of the physical machine state without first being permitted to do so by a virtual machine manager (VMM) that controls the virtual machine. Such a container can prevent “buggy” or malicious software from causing problems on the physical machine. Additionally, virtualization can be used to execute two or more privileged programs on the same physical machine concurrently. The privileged programs can be prevented from interfering with each other since access to the physical machine is controlled. Privileged programs may include operating systems, and may also include other software which expects to have full control of the hardware on which the software is executing. In another example, virtualization can be used to execute a privileged program on hardware that differs from the hardware expected by the privileged program.
Generally, virtualization of a processor or computer system may include providing one or more privileged programs with access to a virtual machine (the container mentioned above) over which the privileged program has full control, but the control of the physical machine is retained by the VMM. The virtual machine may include a processor (or processors), memory, and various peripheral devices that the privileged program expects to find in the machine on which it is executing. The virtual machine elements may be implemented by hardware that the VMM allocates to the virtual machine, at least temporarily, and/or may be emulated in software. Each privileged program (and related software in some cases, such as the applications that execute on an operating system) may be referred to herein as a guest. Virtualization may be implemented in software (e.g. the VMM mentioned above) without any specific hardware virtualization support in the physical machine on which the VMM and its virtual machines execute. However, virtualization may be simplified and/or achieve higher performance if some hardware support is provided.
One issue that can arise with virtualization is the latency of interrupt delivery. As mentioned above, peripheral devices can be allocated for use by a virtual machine (to act as the virtual peripheral device in the virtual machine). Such peripheral devices can generate interrupts that are to be processed by the software in the virtual machine. In non-virtualized environments, the interrupt processing latency can be relatively short. In virtualized environments, the interrupts are generally intercepted by the VMM, processed by the VMM, and delivered to the targeted virtual machine by the VMM using a software mechanism of some sort. However, the interrupt processing latency can be significantly greater (about 100 times longer, for example) than environments which are not virtualized. In addition to peripheral device-generated interrupts (more briefly, “device interrupts” herein), processors can generate interprocessor interrupts (IPIs). In a virtual machine, an IPI can be generated between a virtual processor (or vCPU) and another vCPU in the virtual machine. The vCPUs are the processors defined to be included in the virtual machine of a given guest. There is at least one vCPU in a guest, but there may be multiple vCPUs for a multiprocessing guest.